<?
require("JSON.php");

//$c = pg_connect("host=192.168.0.123 user=postgres password=fac123$$ dbname=prefeitura_sp");
$c = pg_connect("host=localhost user=postgres password=odraude dbname=sudene_intranet");
//$q = pg_query("select title as nome, articleId as email from journalarticle limit 20 offset 0");
$q = pg_query("select nome,email from usuario limit 20 offset 0");

$data = array();

while ($r = pg_fetch_assoc($q)) {
	$n = $r[nome];
	$e = $r[email];
	
	$columns = array(
		array("text"=>$n, "value"=>$e, "icon"=>"edit.gif"),
		array("text"=>"<span class=snippet>$e</span>", "value"=>$e)
	);
	
	array_push($data, $columns);
	
}
echo $json->encode($data);

?>